import React, { memo } from 'react';
import { Form, Radio, Input, Icon } from 'antd';

const evaluationFormLayout = {
    wrapperCol: { span: 18 },
    labelCol: { span: 6 }
};
const { TextArea } = Input;
const Evaluation = memo(({ form, onSubmit, loading, interviewerEmployeeInfo, ...rest }) => {
    const { getFieldDecorator, getFieldError } = form;
    return (
        <Form {...evaluationFormLayout} {...rest}>
            <Form.Item label="建议">
                {getFieldDecorator('hasAgree', {
                    initialValue: 1
                })(
                    <Radio.Group>
                        <Radio value={1}>同意</Radio>
                        <Radio value={0}>拒绝</Radio>
                    </Radio.Group>
                )}
            </Form.Item>
            <Form.Item label="理由" required={false}>
                {getFieldDecorator('reason', {
                    initialValue: '',
                    rules: [{ required: true, min: 2, max: 200, message: '请输入理由，2-200字符' }]
                })(
                    <TextArea
                        placeholder="请输入理由，2-200字符"
                        style={{ width: 340 }}
                        autoSize={{ minRows: 3, maxRows: 3 }}
                    />
                )}
                {
                    interviewerEmployeeInfo.length === 1 && !getFieldError('reason') && <div style={{ display: 'flex', alignItems: 'center', color: '#FF4F60', fontSize: 14 }}>
                        <Icon type="exclamation-circle" theme="filled" style={{ color: 'rgba(255,0,0,0.65)' }}/>
                        <span style={{ marginLeft: 9 }}>无其他面谈参与人，您的面谈建议将作为面谈结论</span>
                    </div>
                }
            </Form.Item>
        </Form>
    );
});
export default Evaluation;
